<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- public quote -->
<%@include file="/jsp/comm_css_include.jsp"%>
<link href="${basePath}/js/plugins/layer/laydate/need/laydate.css"
	rel="stylesheet">
<!-- jqgrid-->
<link
	href="${basePath}/css/plugins/jqgriddemo/css/ui.jqgrid-bootstrap.min.css"
	rel="stylesheet" />
<!doctype html>
<html>
<head>
</head>
<body class="gray-bg">
	<div class="container creditbody">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;贷后业务&gt;续保业务&gt;出险理赔登记</span>
		</div>
		<div class="ibox-content ibox-conc">
			<%@include file="/jsp/common_lipei_include.jsp"%>
			<div class="tab-panecx">
				<div class="business-manwife">出险信息</div>
				<div class="tche-padding">
					<button type="button" class="btn dpbtn_green" onclick="creatorder()">新增</button>
					<div class="ibox-content" style="border-top: none">
						<div class="jqGrid_wrapper">
							<table id="table_list_1"></table>
							<div id="pager_list_1"></div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>
	<!-- jqGrid -->
	<script type="text/javascript" charset="utf-8" src="${basePath}/js/plugins/jqgriddemo/js/jquery.jqGrid.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="${basePath}/js/plugins/jqgriddemo/js/grid.locale-cn.min.js"></script>
	<script type="text/javascript" src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>
	<!--
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
    	$(function(){
    		getData();
    	});
    	
    	
    	var changelayer;
    	var getData = function()
	    {
    		var winWidth = $("#table_list_1").parent("div.ibox-content").width();
	  	  $.jgrid.defaults.styleUI = 'Bootstrap';
		  jQuery("#table_list_1").jqGrid
		  ({
			url:'${basePath}/DhInsuranceCompensationController/list',
	        datatype : "json",
	        postData:{"insuranceId":$.getUrlData("insuranceId")},
	        colNames : [ '主键', '','','出险日', '受理日', '保单号', '合计金额', '申请理赔金额','理赔专员', '保险公司'],
	        colModel : [ 
	                     {name: 'replaceId', index: 'id', hidden:true},
	                     {name: 'busiId', index: 'busiId', hidden:true},
	                     {name: 'cusId', index: 'cusId', hidden:true},
	                     {name: 'dateCompensation',index: 'dateCompensation',width: 170,align: "center",formatter:function(a,b,c){
	                       	 return formateStringDate(a);
	                     }},
	                  	 {name: 'dateAccept',index: 'dateAccept',width: 170,align: "center",formatter:function(a,b,c){
	                       	 return formateStringDate(a);
	                     }},
	                  	 {name: 'noInsurance',index: 'noInsurance',width: 170,align: "center"},
	               		 {name: 'feeTotal',index: 'feeTotal',width: 170,align: "center"},
	            		 {name: 'amountIndemnity',index: 'amountIndemnity',width: 170,align: "center"},
	            		 {name: 'operatorSettlement',index: 'operatorSettlement',width: 170,align: "center"},
	            		 {name: 'companyInsurance',index: 'companyInsurance',width: 300,align: "center"}
	                   ],
              mtype : "post",
              height: 250,
              width:winWidth,  
              autowidth: false,
              shrinkToFit: false,
              rowNum: 15,
              rowList: [15, 30, 45],
              viewrecords: true,
              pager: "#pager_list_1",
              hidegrid: false,
              multiselect : false,
              altRows:true,
              altclass:'someClass',
              ondblClickRow:function(rowId,v,e)
              {
            	  var rowData = $("#table_list_1").jqGrid("getRowData", rowId);
            	  var id = rowData.replaceId;
            	  var busiId = rowData.busiId;
            	  var cusId = rowData.cusId;
            	  changelayer=layer.open({
    		    	  type: 2,
    		    	  title: '修改出险',
    		    	  shadeClose: true,
    		    	  shade: 0.8,
    		    	  area: ['890px', '80%'],
    		    	  content: 'chuxianXQ.jsp?busiId='+busiId+"&cusId="+cusId+"&id="+id+"&insuranceId="+$.getUrlData("insuranceId"),
    		    	  end: function () 
    		    	  {
    		    		  refresh();
    		          }
    	    	 });
              },
              jsonReader : {
            	  root:"result.rows",
            	  page: "result.page",
            	  total: "result.total",
            	  records: "result.records",
            	  repeatitems: false,
            	  id: "replaceId"
              },
              loadComplete:function(datas){
            	  if (datas.flag == "100100") {
                      layer.msg("查询成功!", {icon: 6, time: 1000});
                      return;
                  }
            	  if(datas.flag == '100802') {
    				  top.location.href = thisLoginUrl;
    				  return;
    			  }

              }
	      });
	    }	    
	    
    	var creatorderlayer;
    	
    	var creatorder=function(){
    		var busiId=$.getUrlData("busiId");
    		var cusId=$.getUrlData("cusId");
    		creatorderlayer = layer.open({
		    	  type: 2,
		    	  title: '新建出险',
		    	  shadeClose: true,
		    	  shade: 0.8,
		    	  area: ['890px', '80%'],
		    	  content: 'chuxianXQ.jsp?busiId='+busiId+"&cusId="+cusId+"&insuranceId="+$.getUrlData("insuranceId"),
		    	  end: function () 
		    	  {
		    		  refresh();
		          }
	    	});
    	}
	    var allSave=function(){
	    	var data = $('#commentForm').serialize();
	    	$.dpAjax({
	    		url:'${basePath}/DhInsuranceCompensationController/save',
	    		data:data,
   				success: function(datas){
	    			  if(datas.flag == "100100")
					  {
	    				  layer.msg('执行成功！', {icon: 6});
						  return;
					  }
					  if(datas.flag == "100200")
	                  {
						  $.fn.showDatas({"datas":datas});
	                	  return;
	                  }
                }
	    	});
	    }
	    
	    var refresh = function()
	    {
	    	$("#table_list_1").jqGrid("setGridParam", { search: true }).trigger("reloadGrid", []);
	    }
	    var formateStringDate=function(sDate1){
	    	if(!sDate1 || sDate1 == ''){
	    		return '-';
	    	}
	    	var aDate  =  sDate1.substring(0,sDate1.lastIndexOf(" "));
	    	return aDate;
	    }
    </script>
</body>
</html>
